package me.ywy.kotlinvideo.utils

import android.support.v7.widget.Toolbar
import android.view.MenuItem
import me.ywy.kotlinvideo.R
import me.ywy.kotlinvideo.ui.activity.SettingActivity
import org.jetbrains.anko.startActivity
import java.util.*

/**
 * Created by ywy on 2018-11-02.
 */
interface ToolBarManager {

    val toolbar : Toolbar

    fun initMainToolBar(){
        toolbar.setTitle("Kotlin影音")
        toolbar.inflateMenu(R.menu.menu)
        toolbar.setOnMenuItemClickListener(object: Toolbar.OnMenuItemClickListener {
            override fun onMenuItemClick(item: MenuItem?): Boolean {
                when(item?.itemId){
                    R.id.setting->{
                        //跳转到设置页面
                        toolbar.context.startActivity<SettingActivity>()
                    }
                }
                return true
            }
        })
    }

    fun initSettingToolBar(){
        toolbar.setTitle("设置")

    }

    fun initAboutToolBar(){
        toolbar.setTitle("关于")

    }
}